package com.anc.platform.model.platform.entity;

import java.time.LocalDateTime;
import java.io.Serializable;
import java.util.List;

import com.anc.platform.utils.AbstractTreeNode;
import com.baomidou.mybatisplus.annotation.TableField;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonInclude;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

/**
 * <p>
 * 菜单表
 * </p>
 *
 * @author Anc
 * @since 2022-07-07
 */
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
public class SysMenu extends AbstractTreeNode<SysMenu> implements Serializable {

    private static final long serialVersionUID=1L;

    /**
     * 主键id
     */
    private String id;

    /**
     * 菜单名称
     */
    private String name;

    /**
     * 菜单编码
     */
    private String code;

    /**
     * 菜单级别
     */
    private Integer level;

    /**
     * 父级菜单id
     */
    private String parentId;

    /**
     * 菜单类型
     */
    private Integer type;

    /**
     * 菜单排序
     */
    private Integer sort;

    /**
     * 图标
     */
    private String icon;

    /**
     * 菜单链接地址
     */
    private String path;

    /**
     * 菜单隐藏状态
     */
    private Integer hiddenStatus;

    /**
     * 创建时间
     */
    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private LocalDateTime createTime;

    /**
     * 更新时间
     */

    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private LocalDateTime updateTime;

    /**
     * 外部链接地址
     */
    private String url;

    /**
     * 所属域
     */
    private Integer domain;

    /**
     * 创建人
     */
    private String createBy;

    /**
     * 删除状态
     */
    private Integer delFlag;


    /**
     * 子类目(树形结构)
     */
//    @JsonInclude(value = JsonInclude.Include.NON_NULL)
    @TableField(exist = false)
    private List<SysMenu> children;

    @Override
    public String getParentCode() {
        return this.parentId;
    }
    @Override
    public String getCode() {
        return this.id;
    }

    @Override
    public List<SysMenu> getChildren() {
        return children;
    }

    @Override
    public void setChildren(List<SysMenu> children) {
        this.children = children;
    }
}
